<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>在线图片压缩工具</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="container">
        <header>
            <h1>在线图片压缩工具</h1>
            <p>支持PNG、JPG格式图片在线压缩</p>
        </header>

        <main>
            <!-- 上传区域 -->
            <div class="upload-area" id="uploadArea">
                <input type="file" id="imageInput" accept="image/png, image/jpeg" hidden>
                <div class="upload-box">
                    <svg class="upload-icon" viewBox="0 0 24 24">
                        <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
                    </svg>
                    <p>点击或拖拽图片到此处</p>
                    <p class="upload-hint">支持PNG、JPG格式图片</p>
                </div>
            </div>

            <!-- 压缩控制区域 -->
            <div class="compression-controls" id="compressionControls" style="display: none;">
                <div class="quality-control">
                    <label for="quality">压缩质量: <span id="qualityValue">80%</span></label>
                    <input type="range" id="quality" min="1" max="100" value="80">
                </div>
            </div>

            <!-- 预览区域 -->
            <div class="preview-container" id="previewContainer" style="display: none;">
                <div class="preview-box">
                    <h3>原图</h3>
                    <div class="image-container">
                        <img id="originalPreview" alt="原始图片预览">
                    </div>
                    <div class="file-info">
                        <span id="originalSize"></span>
                    </div>
                </div>

                <div class="preview-box">
                    <h3>压缩效果</h3>
                    <div class="image-container">
                        <img id="compressedPreview" alt="压缩后预览">
                    </div>
                    <div class="file-info">
                        <span id="compressedSize"></span>
                    </div>
                    <button id="downloadBtn" class="download-btn">下载压缩后的图片</button>
                </div>
            </div>
        </main>
    </div>
    <script src="script.js"></script>
</body>
</html> 